define(function(require){
	var $ = require("jquery");
	var justep = require("$UI/system/lib/justep");

	var Model = function(){
		this.callParent();
		this.areaId = '';
		this.loadDone = false;
	};



	Model.prototype.modelParamsReceive = function(event){	    
		this.areaId = event.params.areaId;
		
		this.comp("streetList").refresh(true);
		
	
	};

	Model.prototype.streetListClick = function(event){
		var streetId = this.comp("streetData").getCurrentRowID();
		justep.Shell.showPage("$UI/communityOto/community/areaList.w",{"streetId":streetId});

	};


	


	Model.prototype.scrollView1PullDown = function(event){

	};


	Model.prototype.scrollView1PullUp = function(event){

	};


	Model.prototype.streetDataCustomRefresh = function(event){
	     
	     
		 if(this.areaId){
		    
	    	var url = this.getParentModel().serverUrl + "/ex_community/a/api/community/officeMap?callback=?";
	    	if(event.source.count() < event.offset){
	    		return;
	    	}	
	    	
	    	var page = event.offset/event.limit + 1;
			$.getJSON(url,
			{"id":this.areaId,
			"pageSize":event.limit,
			"pageNo":page},
			function(data){
			    if(data && data.data){
			    	event.source.loadData(data.data,true,null,event.offset,true);
			    }
				
			});	    
	    }
	};


	return Model;
});